package ejemplo;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;

public class Reglas extends Shell {
	private Text textEdadMinima;
	private Text textEdadMaxima;
	private Text textClaseSocial;
	private Text textCliente;
	private Text textUltimaLLamada;
	private Text textTipo;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String args[]) {
		try {
			Display display = Display.getDefault();
			Reglas shell = new Reglas(display);
			shell.open();
			shell.layout();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the shell.
	 * @param display
	 */
	public Reglas(Display display) {
		super(display, SWT.SHELL_TRIM);
		setLayout(new FormLayout());
		
		Composite composite = new Composite(this, SWT.NONE);
		FormData fd_composite = new FormData();
		fd_composite.top = new FormAttachment(0, 10);
		fd_composite.left = new FormAttachment(0, 10);
		fd_composite.bottom = new FormAttachment(0, 334);
		fd_composite.right = new FormAttachment(0, 434);
		composite.setLayoutData(fd_composite);
		composite.setLayout(new GridLayout(2, false));
		
		Label lblIncidencia = new Label(composite, SWT.NONE);
		lblIncidencia.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblIncidencia.setText("Incidencia");
		
		Combo comboIncidencia = new Combo(composite, SWT.NONE);
		comboIncidencia.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblProfesion = new Label(composite, SWT.NONE);
		lblProfesion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblProfesion.setText("Profesion:");
		
		Combo comboProfesion = new Combo(composite, SWT.NONE);
		comboProfesion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblAccion = new Label(composite, SWT.NONE);
		lblAccion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblAccion.setText("Accion");
		
		Combo comboAccion = new Combo(composite, SWT.NONE);
		comboAccion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblEdadMininma = new Label(composite, SWT.NONE);
		lblEdadMininma.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblEdadMininma.setText("Edad Mininma:");
		
		textEdadMinima = new Text(composite, SWT.BORDER);
		textEdadMinima.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblEdadMaxima = new Label(composite, SWT.NONE);
		lblEdadMaxima.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblEdadMaxima.setText("Edad Maxima:");
		
		textEdadMaxima = new Text(composite, SWT.BORDER);
		textEdadMaxima.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblClaseSocial = new Label(composite, SWT.NONE);
		lblClaseSocial.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblClaseSocial.setText("Clase Social:");
		
		textClaseSocial = new Text(composite, SWT.BORDER);
		textClaseSocial.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblCliente = new Label(composite, SWT.NONE);
		lblCliente.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblCliente.setText("Cliente:");
		
		textCliente = new Text(composite, SWT.BORDER);
		textCliente.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblUltimaLlamada = new Label(composite, SWT.NONE);
		lblUltimaLlamada.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblUltimaLlamada.setText("Ultima Llamada: ");
		
		textUltimaLLamada = new Text(composite, SWT.BORDER);
		textUltimaLLamada.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		
		Label lblTipo = new Label(composite, SWT.NONE);
		lblTipo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		lblTipo.setText("Tipo: ");
		
		textTipo = new Text(composite, SWT.BORDER);
		textTipo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		new Label(composite, SWT.NONE);
		
		Button btnEnviar = new Button(composite, SWT.NONE);
		btnEnviar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		btnEnviar.setText("Enviar");
		createContents();
	}

	/**
	 * Create contents of the shell.
	 */
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 383);

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}
